package cn.faifai.tagapi.dto;

import cn.faifai.tagapi.entity.IFile;
import cn.faifai.tagapi.entity.Tag;
import lombok.Data;

import java.util.Set;
@Data
public class FileSerialize {

    private Long id;


    private String fileName;

    /**
     * 注册磁盘
     */
    private String disk;

    /**
     * 地址（相对磁盘）
     */
    private String path;

    /**
     * 文件后缀
     */
    private String suffix;

    /**
     * 文件校验
     */
    private String SHA256Str;

    /**
     * 硬链接状态：0-不存在 1-存在
     */
    private Integer hardLinkStatus = 0;

    /**
     * 预删除状态（标记回收站）：0-未删除 1-已删除
     */
    private Integer preDeleteStatus = 0;

    private Set<Tag> tags;

    public FileSerialize() {
    }
    public FileSerialize(IFile iFile){
        if (iFile == null) return;
        this.id = iFile.getId();
        this.fileName = iFile.getFileName();
        this.disk = iFile.getDisk();
        this.path = iFile.getPath();
        this.suffix = iFile.getSuffix();
        this.SHA256Str = iFile.getSHA256Str();
        this.hardLinkStatus = iFile.getHardLinkStatus();
        this.preDeleteStatus = iFile.getPreDeleteStatus();
        this.tags = iFile.getTags();
    }
}
